<% if allowed_to? :vote, :initiative, initiative: initiative %>
  <% if steps %>
    <%= link_to(
      vote_label,
      initiative_signatures_path(initiative_slug: current_initiative.slug),
      class: "button button__xl w-full button__secondary"
    ) %>
  <% else %>
    <%= button_to(
      vote_label,
      initiative_signatures_path(initiative_slug: current_initiative.slug),
      remote: true,
      data: { disable: true },
      class: "button button__xl w-full button__secondary"
    ) %>
  <% end %>
<% else %>
  <% if initiative.voted_by?(current_user) %>
    <% if allowed_to? :unvote, :initiative, initiative: initiative %>
      <%= button_to(
        initiative_initiative_vote_path(initiative_slug: current_initiative.slug),
        method: :delete,
        remote: true,
        data: { disable: true },
        class: "button button__xl w-full button__secondary success"
      ) do %>
        <%= icon "check-line" %>
        <%= unvote_label %>
      <% end %>
    <% else %>
      <button class='button button__xl w-full button__secondary success' disabled>
        <%= icon "check-line" %>
        <%= unvote_label %>
      </button>
    <% end %>
  <% else %>
    <%= action_authorized_link_to(
      :vote,
      t("vote", scope: "decidim.initiatives.initiatives.vote_cabin"),
      steps ? initiative_signatures_path(initiative_slug: current_initiative.slug, locale: current_locale) : initiative_path(current_initiative, locale: current_locale),
      resource: current_initiative,
      permissions_holder: current_initiative.type,
      authorizations_modal_path: authorization_sign_modal_initiative_path(current_initiative, locale: current_locale),
      class: "button button__xl w-full button__secondary"
    ) %>
  <% end %>
<% end %>
